#include <iostream>
using std::cout;
using std::endl;

//Base是抽象类
class Base
{
public:
    virtual void print() const
	{
		cout << "_base:" << _base << endl;
	}
protected:
    Base(long base)
    : _base(base)
    {}

    long _base;
};

class Derived
: public Base
{
public:
    Derived(long base,long derived)
    : Base(base)
    , _derived(derived)
    //成员子对象的初始化不能使用Base的构造函数
    /* , _b1(base) */
    {}

    void print() const
	{
		cout << "_base:" << _base
		<< ", _derived:" << _derived << endl;
	}
private:
    long _derived;
    /* Base _b1; */
};

/* class Test */
/* { */
/* public: */
/*     Test() */
/*     : _b1(1)//error */
/*     {} */
/* private: */
/*     Base _b1; */
/* }; */


void test0(){
    /* Base b1(10); */
    Derived d1(4,8);
    Base * pb = &d1;
    pb->print();
}

int main(void){
    test0();
    return 0;
}
